package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zr.model.Cuser;
import com.zr.service.ShoScopService;
import com.zr.service.ShowScopeService;


import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * 配送点的配送范围等基本信息
 * @author Administrator
 *lxg
 */
@Controller
@Scope(value="prototype")
public class ShowScopeAction implements ServletResponseAware{
	private int page;
	private int rows;
	@Resource
	private ShowScopeService showScopeServiceImpl;
	
	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getRows() {
		return rows;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	private HttpServletResponse rsp;
	
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		this.rsp=arg0;
		
	}
public void showScope(){
	rsp.setCharacterEncoding("utf8");
	       try {
				PrintWriter	pw = rsp.getWriter();
				rsp.setCharacterEncoding("utf8");
				JSONObject jo=showScopeServiceImpl.findScope(page, rows);
				pw.write(jo.toString());
				pw.flush();
				pw.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
				
			
		
		
	
		
	}


}
